import request from "@/api/request";
import {getEnterpriseId,getUserId} from "@/plugin/auth";

export const getPermissionList = ()=>{
    const params = {
        user_id:getUserId(),
        enterprise_id:getEnterpriseId()
    }
    return request.get('/permission',params)
}
export const getPermissionKeys = ()=>{
    const params = {
        user_id: getUserId(),
        enterprise_id:getEnterpriseId()
    }
    return request.get('/permission/keys',params)
}
export const createPermission = (data:any)=>{
    return request.post('/permission',data)
}
export const updatePermission = (data:any)=>{
    return request.put('/permission',data)
}
export const deletePermissionById = (id:number)=>{
    return request.delete('/permission/'+id)
}
export const roleList = ()=>{
    const params = {
        user_id:getUserId(),
        enterprise_id:getEnterpriseId()
    }
    return request.get('/role',params)
}
export const roleCreate = (data:any)=>{
    return request.post('/role',data)
}
export const roleUpdate = (data:any)=>{
    return request.put('/role',data)
}

export const roleDetail = (id:number)=>{
    return request.get('/role/detail',{id:id})
}
export const roleDelete = (id:number)=>{
    return request.delete('/role/'+id)
}